package com.tengju.user.domain.model.archive.resume;

import com.tengju.user.domain.shared.ValueObject;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.Objects;

@Data
@AllArgsConstructor
public class CompanyInfo implements ValueObject<CompanyInfo> {

    /**
     * 公司名
     */
    private String companyName;

    /**
     * 公司地址
     */
    private String address;

    /**
     * 员工数量
     */
    private Integer staffCount;


    @Override
    public boolean sameValueAs(CompanyInfo that) {
        return that != null && Objects.equals(companyName, that.companyName) &&
                Objects.equals(address, that.address) &&
                Objects.equals(staffCount, that.staffCount);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CompanyInfo that = (CompanyInfo) o;
        return this.sameValueAs(that);
    }

    @Override
    public int hashCode() {
        return Objects.hash(companyName, address, staffCount);
    }
}
